package com.lechuang.member.manager.Impl;

import com.lechuang.member.entity.MemberGroupBuyLevel;
import com.lechuang.member.manager.MemberGroupBuyManager;
import com.lechuang.member.service.MemberGroupBuyLevelService;
import com.lechuang.member.vo.MemberGroupBuyLevelVo;
import jakarta.annotation.Resource;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @author apple
 * @version 1.0
 * @date 2024/6/22
 */
@Service
@Log4j2
public class MemberGroupBuyManagerImpl implements MemberGroupBuyManager {

    @Resource
    private MemberGroupBuyLevelService memberGroupBuyLevelService;

    @Override
    public List<MemberGroupBuyLevelVo> list() {
        List<MemberGroupBuyLevelVo> memberGroupBuyLevelVos =new ArrayList<>();
        List<MemberGroupBuyLevel> list = memberGroupBuyLevelService.list();
        list.forEach(bean->{
            MemberGroupBuyLevelVo memberGroupBuyLevelVo =new MemberGroupBuyLevelVo();
            memberGroupBuyLevelVo.setId(bean.getId());
            memberGroupBuyLevelVo.setName(bean.getName());
            memberGroupBuyLevelVos.add(memberGroupBuyLevelVo);
        });

        return memberGroupBuyLevelVos;
    }
}
